package strategy1;

import java.util.Date;

public class RegularVisitTaskGenerator extends AbstractTaskGenerator{
    @Override
    TaskType getTaskType() {
        return TaskType.REGULAR_VISIT;
    }

    @Override
    Date calculateExecuteTime(TaskContext context) {
        // 常规随访在购药后7天执行
        return new Date(context.getPurchaseDate().getTime() + 7 * 24 * 60 * 60 * 1000L);
    }

    @Override
    boolean validateData(TaskContext context) {
        // 常规随访需要额外校验用药天数
        return super.validateData(context) && context.getMedicationDays() != null;
    }
}
